﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<script src="Scripts/jquery-1.4.2.js" type="text/javascript"></script>
    <script language="javascript">
        function CallHandler() {
            $.ajax({
                url: "Ajax.ashx",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: { 'ID': $("#txtID").val() },
                responseType: "json",
                success: OnComplete,
                error: OnFail
            });
            return false;
        }

        function OnComplete(result) {
            alert([result.ID, result.Name]);
        }
        function OnFail(result) {
            alert('Employee does not exist ');
        }
    </script>

   
    <form id="form1" runat="server">
    <div>
        <input id="txtID" type="text" />   
        <input id="Submit1" type="submit" value="search" onclick="return CallHandler()"/>
    </div>
    </form>
</body>
</html>
